import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:恋恋
 * Date:2022-10-31
 * Time:17:09
 */
public class TestDemo {
    public static void main(String[] args) {
        Pokers pokers=new Pokers();

        System.out.println("刚买的扑克牌");

       List<Poker>list=pokers.buyPoker();

        System.out.println(list);

        System.out.println("开始洗牌");

        pokers.Shuffle(list);

        System.out.println(list);



        List<List<Poker>> listPeople=new ArrayList<>(3);

        //这里要小心：没有创建（add）是无法获得（get）

        listPeople.add(new ArrayList<>());
        listPeople.add(new ArrayList<>());
        listPeople.add(new ArrayList<>());
        //三个人，每个人轮流抓5张牌-相当于二维数组，3行5列
        for (int i = 0; i < 5; i++) {

            for (int j = 0; j < 3; j++) {

                //remove方法是删除原来的牌+返回删除的元素
                listPeople.get(j).add(list.remove(0));
            }
        }
        int i=0;

        for (List<Poker> people:listPeople) {

            i++;
            System.out.println("第"+i+"个人手中的牌：");

            System.out.print(people);

            System.out.println();
        }
        //剩余的牌

        System.out.println("剩余的牌有：");

        System.out.println(list);

    }
}
